// 使用新的@use规则代替@import
@use 'sass:color';
// 只保留一个@use指令来导入变量
@use './variables.scss' as vars;

// 全局样式，从原有CSS迁移
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: vars.$font-family;
  color: vars.$color-text;
  line-height: 1.6;
  background-color: vars.$color-bg;
}

a {
  color: vars.$color-primary;
  text-decoration: none;
  
  &:hover {
    text-decoration: underline;
  }
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background-color: vars.$color-bg;
  border: 1px solid vars.$color-border;
  color: vars.$color-text;
  transition: all 0.3s ease;
  
  &:hover {
    border-color: vars.$color-primary;
    color: vars.$color-primary;
  }
  
  &.btn-primary {
    background-color: vars.$color-primary;
    border-color: vars.$color-primary;
    color: white;
    
    &:hover {
      background-color: color.adjust(vars.$color-primary, $lightness: -5%);
      border-color: color.adjust(vars.$color-primary, $lightness: -5%);
      color: white;
    }
  }
  
  &.btn-export {
    margin-left: 10px;
  }
}

// 布局
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: vars.$color-secondary;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  
  img {
    height: 32px;
    margin-right: 10px;
  }
  
  span {
    font-size: 20px;
    font-weight: bold;
  }
}

.container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  border-right: 1px solid vars.$color-border;
  overflow-y: auto;
  background-color: vars.$color-bg-secondary;
  height: calc(100vh - 108px);
}

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  height: calc(100vh - 108px);
}

.footer {
  padding: 16px 24px;
  text-align: center;
  border-top: 1px solid vars.$color-border;
  color: vars.$color-text-light;
}

// 搜索框
.search-box {
  padding: 16px;
  border-bottom: 1px solid vars.$color-border;
  
  input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid vars.$color-border;
    border-radius: 4px;
    font-size: 14px;
    
    &:focus {
      outline: none;
      border-color: vars.$color-primary;
    }
  }
}

// 组件列表
.component-list {
  padding: 16px;
}

.component-item {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  
  &:hover {
    background-color: rgba(65, 184, 131, 0.1);
  }
  
  &.active {
    background-color: rgba(65, 184, 131, 0.2);
    border-left: 3px solid vars.$color-primary;
  }
  
  h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: vars.$color-secondary;
  }
  
  p {
    font-size: 13px;
    color: vars.$color-text-light;
  }
}

.loading {
  text-align: center;
  padding: 20px;
  color: vars.$color-text-light;
}

// 组件详情
.welcome {
  text-align: center;
  padding: 40px 20px;
  
  h1 {
    font-size: 32px;
    color: vars.$color-primary;
    margin-bottom: 16px;
  }
}

.component-detail {
  max-width: 900px;
  margin: 0 auto;
  
  h1 {
    font-size: 28px;
    color: vars.$color-secondary;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
  }
  
  .badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 12px;
    font-weight: normal;
    
    &.vue-version {
      background-color: vars.$color-primary;
      color: white;
    }
  }
}

.section {
  margin-top: 32px;
  
  h2 {
    font-size: 22px;
    color: vars.$color-secondary;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid vars.$color-border;
  }
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.info-item {
  background-color: vars.$color-bg-secondary;
  padding: 12px;
  border-radius: 4px;
  
  strong {
    display: block;
    font-size: 14px;
    color: vars.$color-text-light;
    margin-bottom: 4px;
  }
  
  span, 
  code {
    word-break: break-all;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

table th,
table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid vars.$color-border;
}

table th {
  font-weight: 600;
  background-color: vars.$color-bg-secondary;
}

code {
  font-family: vars.$font-family-code;
  background-color: vars.$color-bg-code;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 90%;
  color: vars.$color-secondary;
}

pre {
  background-color: vars.$color-bg-code;
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 16px 0;
}

pre code {
  background-color: transparent;
  padding: 0;
}

.event-item,
.method-item,
.slot-item {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid vars.$color-border;
  
  h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: vars.$color-secondary;
  }
}

// 响应式样式
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid vars.$color-border;
  }
  
  .header {
    flex-direction: column;
  }
  
  .header-right {
    margin-top: 12px;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
} 